package com.itheima.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mpi (){

        //1. 构建mybatisplus 拦截器集合
        MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();

        //2. 追加分页拦截器
        mpi.addInnerInterceptor(new PaginationInnerInterceptor());

        //3. 返回拦截器集合
        return mpi;

    }
}
